﻿Imports System.Windows.Forms.Integration
Imports System.IO

Public Class ParitorXPSDocumentViewer

    Private WithEvents wpfExtension As ParitorWPF.XPSDocumentViewer

    Private Sub ParitorDocumentViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim host As New ElementHost
        wpfExtension = New ParitorWPF.XPSDocumentViewer
        host.Child = wpfExtension
        host.Dock = Forms.DockStyle.Fill
        Me.Controls.Add(host)

    End Sub

    Public Sub Open()
        wpfExtension.OpenFile()
    End Sub
    Public Function OpenStream(ByVal xpsStream As MemoryStream) As Boolean
        Return wpfExtension.OpenStream(xpsStream)
    End Function
    Public Sub Print(ByVal PrintTicket As Printing.PrintTicket)
        wpfExtension.Print(PrintTicket)
    End Sub
    Public Function HasNextPage() As Boolean
        Return wpfExtension.docViewer.CanGoToNextPage
    End Function
    Public Function HasPrevPage() As Boolean
        Return wpfExtension.docViewer.CanGoToPreviousPage
    End Function
    Public Function CanZoomIn() As Boolean
        Return wpfExtension.docViewer.CanIncreaseZoom
    End Function
    Public Function CanZoomOut() As Boolean
        Return wpfExtension.docViewer.CanDecreaseZoom
    End Function

    Public Sub ZoomIn()
        wpfExtension.docViewer.IncreaseZoom()
    End Sub
    Public Sub ZoomOut()
        wpfExtension.docViewer.DecreaseZoom()
    End Sub
    Public Sub LastPage()
        wpfExtension.docViewer.LastPage()
    End Sub
    Public Sub FirstPage()
        wpfExtension.docViewer.FirstPage()
    End Sub
    Public Sub NextPage()
        wpfExtension.docViewer.NextPage()
    End Sub
    Public Sub PrevPage()
        wpfExtension.docViewer.PreviousPage()
    End Sub
End Class
